package com.test.service;

import com.test.dao.DeliverymanDao;
import com.test.domain.Deliveryman;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class DeliverymanService {

    private final DeliverymanDao deliverymanDao;

    @Autowired
    public DeliverymanService(DeliverymanDao deliverymanDao) {
        this.deliverymanDao = deliverymanDao;
    }

    public void insertDeliveryman(Deliveryman deliveryman){
        deliverymanDao.insertDeliveryman(deliveryman);
    }

    public List<Deliveryman> getDeliverymanList(String phoneNumber){
        return deliverymanDao.getDeliverymanListByPhoneNumber(phoneNumber);

    }

    public void updateIdNumber(String phoneNumber, String idNumber){
        deliverymanDao.updateIdNumber(phoneNumber,idNumber);
    }

    public void updateSituation(String phoneNumber, int situation){
        deliverymanDao.updateSituation(phoneNumber,situation);
    }

    public void deleteDeliveryman(String phoneNumber){
        deliverymanDao.deleteDeliverymanByPhoneNumber(phoneNumber);
    }


}
